<div class="content_filtro">
    <?php if($this->per_add){?>
    <div class="content-btn">
        <span>Novo Aluno</span><a href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit')); ?>">+</a>
    </div>
    <?php } ?>
</div>

<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="post" action="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'index')); ?>">
            <i>Pesquisar</i>
            
            <div class="row">
                <?php
                    $arr_sta = dominio::statusAluno();

                    foreach($arr_sta as $key => $sta){ 
                ?>
                <label><?php echo elemform::radio('stafiltro','stafiltro',$key,$this->stafiltro); ?> <?php echo $sta; ?></label>
                &nbsp;&nbsp;
                <?php } ?>
            </div>
            
            <div class="row">
                <input type="text" name="filtro_nm" style="width: 350px;" placeholder="Aluno" value="<?php echo $this->filtro_nm?>" />
            </div>
            
            <div class="row">
                <?php
                
                $query = 'SELECT SQL_CACHE c.CUR_ID,c.CUR_NOM, cb.CBS_NOM, n.NRT_NOM FROM CURSO c, CURSOBASE cb, NUMEROTURMA n WHERE c.CBS_ID = cb.CBS_ID AND c.CUR_TRM = n.NRT_ID AND c.CUR_STA = 1 and c.CUR_ANO >= '.date('Y')
                        .' ORDER BY cb.CBS_NOM ASC, n.NRT_SEM ASC, n.NRT_HOR ASC';
                $f_cur = $this->db->fetchAll($query);
                
                $html = '<select id="itfiltro" style="width: 362px;" name="itfiltro" class="chosen-select" >';
                $html .= '<option value="">Todas Turmas</option>';
                foreach($f_cur as $r){   
                    $select = $this->filtro == $r['CUR_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['CUR_ID'].'">'.$r['CBS_NOM'].' - '.$r['NRT_NOM'].'</option>'; // $r['CUR_NOM'] 
                }
                $html .= '</select>';
                echo $html;
                ?>
                
                <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
                
            </div>
            
            
        
        </form>
    </div>
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    <br>
    
    <ul class="list-alunos">
    <?php 
        foreach($this->result as $row){ 
        
        $status = strtoupper(aluno::returnStatusAluno($row['ALU_ID'])); 
        
        $img = ''; 
        $imgs = 'public/upload/aluno/'.$row['ALU_ID'].'_tmb.*';
        foreach (glob($imgs) as $src) {
            $img = $src;
        }
        if(strlen($img) < 5) $img = 'public/media/images/sys/avatar.png'; 
        
    ?>  
        <li>
            <div class="content-foto"><img src="<?php echo '/'.$img; ?>" /></div>
            <div class="row"><strong><?php echo $row['ALU_NOM']; ?></strong></div>
            <div class="row"><strong>Status:</strong> <?php echo $status; ?></div>
            <div class="row rwu"><strong>Turma:</strong> <?php if($row['CUR_ID'] > 0){ echo dominio::getTurma($row['CUR_ID']); } ?> </div>
            <div class="content-btn">
                <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['ALU_ID'])); ?>">Editar</a><?php }?>     
                <?php if($this->per_del && $row['ALU_STA'] == 0){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'delete', 'id' => $row['ALU_ID'])); ?>">Deletar</a><?php }?>
            </div>
        </li>
    <?php  } ?>
    </ul>
    
    <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
    
</div>    